package com.tan.steamship.exception;

import com.tan.steamship.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Auther: wdd
 * @Date: 2020-03-19 16:45
 * @Description:
 */
@ControllerAdvice
@ResponseBody
public class XmExceptionHandler {

    @ExceptionHandler(XmException.class)
    public Result handleException(XmException e){
        ExceptionEnum em = e.getExceptionEnum();
        return Result.error(500, em.getCode() + "" + em.getMsg());
    }
}
